package com.xbs.controller.hitchhiking;
import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 查看顺风车的订单
 */
import com.xbs.controller.base.BaseServlet;
import com.xbs.controller.enterprise.DateJsonValueProcessor;
import com.xbs.entity.EmployeeEntity;
import com.xbs.entity.HitchOrderAdminEntity;
import com.xbs.service.hitchhiking.EmpAdminService;
import com.xbs.service.hitchhiking.HitchOrderAdminService;

import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;
import net.sf.json.util.CycleDetectionStrategy;
@WebServlet("/backstage/selhitchorder")
public class SelHitchOrderServlet extends BaseServlet {

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		HitchOrderAdminService hoas = new HitchOrderAdminService();
		
		/**
		 * 根据员工的姓名，编号，身份证查询员工信息
		 */
		String str = req.getParameter("seltext");
		List<HitchOrderAdminEntity> hoalst =  hoas.getHitchOrderByFour(str);
		System.out.println(hoalst);
		JsonConfig jsonConfig = new JsonConfig();   
		jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);   
		jsonConfig.registerJsonBeanProcessor(java.sql.Date.class, new DateJsonValueProcessor());  
		jsonConfig.setExcludes(new String[]{"handler","hibernateLazyInitializer"});    
		JSONArray jsonArray = JSONArray.fromObject(hoalst,jsonConfig);
		//JSONObject obj =JSONObject.fromObject(emplst,jsonConfig); 
		resp.getWriter().print(jsonArray);
		
	}
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
}
